﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UCTimNgach.ascx.cs" Inherits="Viewer.NhanSu.UserControl.UCTimNgach" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<link href="../../resources/css/main.css" rel="stylesheet" type="text/css" />
<ext:Window ID="wdTimNgach" runat="server" Width="800" AutoHeight="true" Modal="true"
    Closable="false" Hidden="true" HideBorders="True" Border="false" Plain="true"
    Resizable="false" Frame="false" Title="Tìm ngạch công chức" Icon="Find">
    <Content>
        <table>
            <tr>
                <td>
                    <ext:Hidden ID="hdTypeCode" runat="server" />
                    <ext:TextField ID="txtMaNgach" runat="server" EmptyText="Điền mã ngạch">
                    </ext:TextField>
                    <ext:TextField ID="txtTenNgach" runat="server" EmptyText="Điền tên ngạch">
                    </ext:TextField>
                </td>
                <td>
                    <ext:Button ID="btnSearch" runat="server" Text="Tìm kiếm" Icon="Zoom">
                    <Listeners>
                    <Click Handler=" Ext.net.Mask.show();" />
                    </Listeners>
                        <DirectEvents>
                            <Click OnEvent="BtnSearch_Click">
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                </td>
            </tr>
        </table>
        <ext:Panel runat="server" ID="asd" Layout="Fit" MonitorResize="true">
            <Items>
                <ext:GridPanel ID="grdNgach" runat="server" Height="300" MonitorResize="true"
                    AutoWidth="true" AutoExpandColumn="GhiChu" StripeRows="true">
                    <ColumnModel ID="ColumnModel1" runat="server">
                        <Columns>
                            <ext:Column Header="Mã Ngạch" DataIndex="CodeString" Width="100" />
                            <ext:Column Header="Tên Ngạch" DataIndex="CodeValue" Width="400" />
                            <ext:Column Header="Ghi Chú" DataIndex="GhiChu" />
                        </Columns>
                    </ColumnModel>
                    <BottomBar>
                        <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageIndex="1" PageSize="20"
                            HideRefresh="true">
                        </ext:PagingToolbar>
                    </BottomBar>
                    <SelectionModel>
                        <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
                    </SelectionModel>
                    <Store>
                        <ext:Store ID="storeNgach" runat="server">
                            <Reader>
                                <ext:JsonReader IDProperty="CodeID">
                                    <Fields>
                                        <ext:RecordField Name="CodeID" />
                                        <ext:RecordField Name="CodeString" />
                                        <ext:RecordField Name="CodeValue" />
                                        <ext:RecordField Name="GhiChu" />
                                    </Fields>
                                </ext:JsonReader>
                            </Reader>
                        </ext:Store>
                    </Store>
                </ext:GridPanel>
            </Items>
        </ext:Panel>
    </Content>
    <Buttons>
        <ext:Button ID="BtnSelect" runat="server" Text="Chọn" Icon="Tick">
            <Listeners>
                <Click Handler="
                Ext.net.Mask.show();
                        var record=#{grdNgach}.selModel.getSelected();
                        if(record!=null) 
                        {
                            InsertNgach(record.data.CodeID,record.data.CodeString,record.data.CodeValue); 
                            #{wdTimNgach}.hide();
                        }else{Ext.net.Mask.hide();
                            Ext.MessageBox.alert('Thông báo', 'Vui lòng chọn ngạch.');
                        }" />
            </Listeners>
        </ext:Button>
        <ext:Button ID="Button1" runat="server" Text="Đóng" Icon="Cancel">
            <Listeners>
                <Click Handler="#{wdTimNgach}.hide();" />
            </Listeners>
        </ext:Button>
    </Buttons>
</ext:Window>

